import request from '@/request'
import {C2B} from '@/utils/wordtransfer.js'

// 获取所有权益
export const findAuthorityList = () => {
    return request.post("/authority/list", {})
}

// 查询搜索并分页
export const findList = (type) => {
    return request.post("/authority/permission/list",{permissionType:type})
}

// 查询搜索并分页
export const findPages = (data) => {
    return request.post("/authority/permission/page",data)
}

// 回收站
export const findPagesRecyle = (data) => {
    return request.post("/authority/permission/recyle",data)
}

// id查询明细
export const getById = (id) => {
    return request.post(`/authority/permission/get/${id}`,{})
}

// 保存和更新
export const saveUpdate = (data) => {
    return request.post("/authority/permission/saveupdate",data)
}

// 修改状态
export const updateStatus = (id,field,value) => {
    field = C2B(field)
    return request.post(`/authority/permission/status/${id}/${field}/${value}`,{})
}

// 批量彻底删除
export const batchRemoves = (ids) => {
    return request.post("/authority/permission/batch/remove",{ids})
}

// 批量上架
export const batchUps = (ids) => {
    return request.post("/authority/permission/batch/up",{ids})
}

// 批量下架
export const batchDowns = (ids) => {
    return request.post("/authority/permission/batch/down",{ids})
}

// 物理删除
export const removeById = (id) => {
    return request.post(`/authority/permission/remove/${id}`,{})
}